<!--
 * @Descripttion:
 * @Author: cbing
 * @Date: 2019-06-17 09:55:00
 * @LastEditors: cbing
 * @LastEditTime: 2019-09-05 10:05:36
 -->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
    <link rel="stylesheet" href="__PUBLIC__/admin/js/layui/css/layui.css">
</head>
<style>
    input.error{
        border:1px solid red;
    }
    span.error{
        padding-top:10px;
        color: #f00;
        font-size:12px;
    }
</style>
<script>
    var url = "{:url('shop_storestaff/lst')}";
    var checkAdname = "{:url('shop_storestaff/checkAdname')}";
    var insertUrl = "{:url('shop_storestaff/add')}";
</script>
<body class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>增加员工</h5>
                    </div>
                    <div class="ibox-content">
                        <form method="post" class="form-horizontal  layui-form" id="form">

                            <div class="form-group">
                                <label class="col-sm-2 control-label">员工姓名：</label>
                                <div class="col-sm-6">
                                    <input type="text" name="name" class="form-control">
                                </div>
                                <label class="col-sm-1" style="padding-top:7px; color:#F00; font-size:16px;">*</label>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">员工电话：</label>
                                <div class="col-sm-6">
                                    <input type="text" name="contact" class="form-control">
                                </div>
                                <label class="col-sm-1" style="padding-top:7px; color:#F00; font-size:16px;">*</label>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <!--<div class="form-group">-->
                                <!--<label class="col-sm-2 control-label">选择会员：</label>-->
                                <!--<div class="col-sm-6">-->
                                    <!--<select name="user_nickname" id="user_nickname" lay-verify="required" autocomplete="off" class="form-control" lay-search="">-->
                                        <!--<option value="">请输入员工电话查找</option>-->
                                    <!--</select>-->
                                <!--</div>-->
                                <!--<label class="col-sm-1" style="padding-top:7px; color:#F00; font-size:16px;">*</label>-->
                            <!--</div>-->
                            <!--<div class="hr-line-dashed"></div>-->

                            <div class="form-group">
                                <label class="col-sm-2 control-label">选择会员：</label>
                                <div class="col-sm-6">
                                    <input type="text" name="phone" class="form-control">
                                </div>
                                <label class="col-sm-1" style="padding-top:7px; color:#F00; font-size:16px;">*</label>
                            </div>
                            <div class="hr-line-dashed"></div>



                            <div class="form-group">
                                <label class="col-sm-2 control-label">请选择门店：</label>
                                <div class="col-sm-6">
                                    <select name="ss_id" class="form-control">
                                        {foreach name="shop_store" item="v"}
                                        <option value="{$v['id']}">{$v['name']}</option>
                                        {/foreach}
                                    </select>
                                </div>
                                <label class="col-sm-1" style="padding-top:7px; color:#F00; font-size:16px;">*</label>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">是否开启：</label>
                                <div class="col-sm-6">
                                    <label class="radio-inline"><input type="radio" name="status" checked="checked" value="1">是</label>
                                    <label class="radio-inline"><input type="radio" name="status" value="0">否</label>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" type="submit" id="doSubmit" style="margin-right:20px;">保存内容</button>
                                    <button type="reset" class="btn btn-default">重置</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

</body>
<!-- 全局js -->
<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
<!-- 自定义js -->
<script type="text/javascript" src="__PUBLIC__/admin/Huploadify/jquery.Huploadify.js"></script>
<script src="__PUBLIC__/admin/js/plugins/validate/jquery.validate.min.js"></script>
<!-- iCheck -->
<script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
<script src="__PUBLIC__/admin/js/common/ajax.js"></script>
<script src="__PUBLIC__/admin/js/layui/layui.js"></script>
<script>
    layui.use(['form'], function(){});
    $(function(){
        $('.del').click(function(){
            $('input[name=logo]').val('');
            $('#imageinfo').attr('src','__PUBLIC__/admin/img/nopic.jpg');
            $('.del').hide();
        });

        var icon = "<i class='fa fa-times-circle'></i>&nbsp;&nbsp;";
        $('#form').validate({
            errorElement : 'span',
            debug: true,//只验证不提交表单
            //layer ajax提交表单
            submitHandler:function(){
                // 序列化 表单数据 后提交 ，太简洁了
                post(insertUrl,'POST',$('#form').serialize(),1);
                return false;
            },//这是关键的语句，配置这个参数后表单不会自动提交，验证通过之后会去调用的方法

            rules:{
                name:{
                    required:true,
                    remote : {
                        url : checkAdname,
                        type : 'post',
                        dataType : 'json',
                        data : {
                            name : function () {
                                return $('input[name=name]').val();
                            }
                        }
                    }
                },
                contact:{required:true},
                phone:{
                    required:true,
                    remote : {
                        url : checkAdname,
                        type : 'post',
                        dataType : 'json',
                        data : {
                            phone : function () {
                                return $('input[name=phone]').val();
                            }
                        }
                    }
                },
                ss_id:{required:true}
            },

            messages:{
                name:{
                    required:icon+'必填',
                    remote:icon+'名称已存在'
                },
                contact:{required:icon+'必选'},
                phone:{
                    required:icon+'必选',
                    remote:icon+'会员非app注册手机'
                },
                ss_id:{required:icon+'必选'},
            }
        });
    });

    function cl(){
        location.href = url;
    }

</script>

</html>